package com.example.aigc_education.enums;

import lombok.Getter;

@Getter
public enum TodoTimerModeType {
    //            "timerMode": "enum('normal', 'pomodoro'), optional, 计时模式类型",
    NO_FOCUS("no_focus",0),
    NORMAL("normal",1),
    POMODORO("pomodoro",2);

    private final String title;
    private final int value;

    TodoTimerModeType(String title, Integer value) {
        this.title = title;
        this.value = value;
    }
    public static TodoTimerModeType fromValue(Integer value) {
        for (TodoTimerModeType type : TodoTimerModeType.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }
        //抛出异常
        throw new IllegalArgumentException("Invalid value: " + value);
    }
    public static TodoTimerModeType fromTitle(String title) {
        for (TodoTimerModeType type : TodoTimerModeType.values()) {
            if (type.getTitle().equals(title)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid title: " + title);
    }
}
